#ifdef WITH_CG
#ifdef WITH_OPENGL

#pragma once
#include "shader_cg.h"
#include <Cg/cgGL.h>

namespace krryn{
namespace system_imp{
	class shader_catalog_cg_opengl;
	class shader_cg_opengl : public shader_cg{
	public:
		shader_cg_opengl(shader_catalog_cg &a_Catalog, const std::string &a_Filename, CGcontext a_Context);
		virtual ~shader_cg_opengl() {}
		virtual void enable();
		virtual void disable();

		virtual void bind_texture2d(view::shader_type a_Type, const std::string &a_Name, view::texture *a_Texture);
		virtual void bind_textures_of_render_target(view::shader_type a_Type, krryn::core::refc_ptr<view::render_target> a_Targets);
		virtual void bind_matrix4x4(view::shader_type a_Type, const std::string &a_Name, const math::matrix &a_Matrix);
		virtual void bind_float4(view::shader_type a_Type, const std::string &a_Name, math::vector4f a_Vector);
		virtual void bind_float3(view::shader_type a_Type, const std::string &a_Name, math::vector3f a_Vector);
		virtual void bind_float2(view::shader_type a_Type, const std::string &a_Name, math::uv a_Vector);
		virtual void bind_float(view::shader_type a_Type, const std::string &a_Name, float a_Scalar);

		virtual void bind_matrix4x4_array(view::shader_type a_Type, const std::string &a_Name, int a_Count, math::matrix *a_Matrix);
		virtual void bind_float4_array(view::shader_type a_Type, const std::string &a_Name, int a_Count, math::vector4f *a_Vector);
		virtual void bind_float3_array(view::shader_type a_Type, const std::string &a_Name, int a_Count, math::vector3f *a_Vector);
		virtual void bind_float2_array(view::shader_type a_Type, const std::string &a_Name, int a_Count, math::uv *a_Vector);
		virtual void bind_float_array(view::shader_type a_Type, const std::string &a_Name, int a_Count, float *a_Scalar);

		void check_error(CGcontext cgContext) const;
	private:
		CGparameter m_Projection;
	};
}
}

#endif
#endif
